package com.gyyx.cn.transaction.test.service;

import com.gyyx.cn.transaction.test.bean.Account;
import com.gyyx.cn.transaction.test.bean.TransferDTO;
import com.gyyx.cn.transaction.test.bean.TransferVO;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional;

import javax.rmi.CORBA.Util;

/**
 * @author: 王海新
 * @date: 2021/12/9/0009 16:06
 * @version: 1.0
 * @description: TODO
 */
@Service
public class TransferService {

    @Autowired
    Account2Service account2Service;

    @Autowired
    AccountService accountService;
    @Transactional(propagation = Propagation.SUPPORTS)
    public void transferService(TransferVO t){
        TransferDTO transferDTO = new TransferDTO();
        transferDTO.setFromCardNo(t.getFromCardNo());
        transferDTO.setMoney(Integer.valueOf(t.getMoney()));
        transferDTO.setToCardNo(t.getToCardNo());
        accountService.transfer(transferDTO);
    }

}
